#include "myLog4.h"
 
log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("logmain"));
 
void InitLogger()
{
	PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("./log4cplus.conf"));

	/*
	//用Initializer类进行初始化
	log4cplus::Initializer initializer;
 
	//第1步：建立ConsoleAppender
	log4cplus::SharedAppenderPtr consoleAppender(new log4cplus::ConsoleAppender);
	log4cplus::SharedAppenderPtr fileAppender(new log4cplus::FileAppender(LOG4CPLUS_TEXT("./test.log")));
 
	//第2步：设置Appender的名称和输出格式（SimpleLayout）
	consoleAppender->setName(LOG4CPLUS_TEXT("test"));
	consoleAppender->setLayout(std::unique_ptr<log4cplus::Layout>(new log4cplus::SimpleLayout()));
 
	fileAppender->setName(LOG4CPLUS_TEXT("test"));
	log4cplus::tstring pattern = LOG4CPLUS_TEXT("%D{%m/%d/%y %H:%M:%S,%Q} [%t] %-5p %c - %m [%l]%n");
	fileAppender->setLayout(std::unique_ptr<log4cplus::Layout>(new log4cplus::PatternLayout(pattern)));
 
	//第3步：得到一个Logger实例，并设置其日志输出等级阈值
	logger.setLogLevel(log4cplus::INFO_LOG_LEVEL);
 
	//第4步：为Logger实例添加ConsoleAppender
	logger.addAppender(consoleAppender);
	logger.addAppender(fileAppender);
 
	//第5步：使用宏将日志输出
	LOG4CPLUS_INFO(logger, LOG4CPLUS_TEXT("InitLogger"));
	*/
}